﻿@model IndexModel.Left
@{
    var x = Html.X();


    var leftPanel = x.Panel()
        .Title("功能面板")
        .Region(Region.West)
        .Width(225).ID("HomeLeftTree")
        .MinWidth(225)
        .MaxWidth(400).BodyPadding(0)
        .Split(true)
        .Collapsible(true)
        .CollapseMode(CollapseMode.Header)
        .CollapseDirection(Direction.Left)
        .ResponsiveConfig(rr =>
        {
            var tabRule = new ResponsiveRule()
            {
                Rule = "width<=1024"
            };
            tabRule.Config.Add(x.Panel().Collapsed(true));
            rr.Add(tabRule);
        });

    leftPanel.Layout(Model.Systems.Count > 1 ? LayoutType.Accordion : LayoutType.Fit);

    var trees = new List<TreePanel>(Model.Systems.Count);
    foreach (var system in Model.Systems)
    {
        var item = x.TreePanel().Border(false).AutoScroll(true).Lines(false)
            .RootVisible(false).HideHeaders(true).Root(Model.LeftTrees[system.Code]).ColumnModel(
                new TreeColumn()
                {
                    DataIndex = "text",
                    Flex = 1
                })
            .Listeners(li =>
            {
                li.ItemClick.Handler = "App.Main.onTreeItemClick(record, e);";
            });
        if (Model.Systems.Count > 1)
        {
            item.Title(system.Name);
        }
        trees.Add(item);
    }
    leftPanel.Items(trees);
}
@(leftPanel)